import request from '@/utils/request'
//
export function setSecKillTime({ id = '', start_time, end_time, auto_close_time }) {
  return request({
    url: 'back/seckill/commoditySecKill',
    method: 'post',
    data: { type: 'setCommodityTime', id, start_time, end_time, auto_close_time }
  })
}
// 秒杀活动
export function getSeckillList(myType, page) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'get',
    params: { type: 'list', myType, page }
  })
}

export function addOrEditSeckill(id) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'get',
    params: { type: 'edit', id }
  })
}
// 获取商品列表
export function getSecKillGoodsMngList({ page, keyword, second_cate_id }) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'get',
    params: { type: 'selectCommodity', keyword, second_cate_id, page }
  })
}
// 获取规格商品列表
export function getSpecGoodsMng(id, seckill_id) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'get',
    params: { type: 'selectSpec', id, seckill_id }
  })
}
// 添加秒杀规格商品
export function addSeckillMng(params, limit_num, seckill_id, id, is_add) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'post',
    params: { type: 'saveSpec', spec_info: params, limit_num, seckill_id, id, is_add }
  })
}
// 获取秒杀会商品
export function getSeckillGoods(id) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'get',
    params: { type: 'getSecKillCommodity', id }
  })
}

// 批量添加
export function multipleAddMng({ id, commodity_info }) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'post',
    params: { type: 'batchSetCommodity', id, commodity_info }
  })
}
// 编辑input
export function editSeckillGoods({ id, seckill_price, seckill_kucun }) {
  return request({
    url: '/back/seckill/commoditySecKill',
    method: 'post',
    data: { type: 'upSecKillCommodity', id, seckill_price, seckill_kucun }
  })
}
export function getSecKillCommodityInfo(id) {
  return request({
    url: 'back/seckill/commoditySecKill',
    method: 'get',
    params: { type: 'getSecKillCommodityInfo', id }
  })
}
export function editSeckill(id) {
  return request({
    url: 'back/seckill/commoditySecKill',
    method: 'get',
    params: { type: 'edit', id }
  })
}
export function deleteSeckill(id) {
  return request({
    url: 'back/seckill/commoditySecKill',
    method: 'post',
    params: { type: 'delete', id }
  })
}
export function removeSeckillItem(id) {
  return request({
    url: 'back/seckill/commoditySecKill',
    method: 'post',
    params: { type: 'removeCommodity', id }
  })
}
export function stopSecKill(id) {
  return request({
    url: 'back/seckill/commoditySecKill',
    method: 'post',
    params: { type: 'rightStop', id }
  })
}
// 秒杀订单
export function getSeckillOrderList({ page, status, order_no, start_time, end_time }) {
  return request({
    url: 'back/shop/order',
    method: 'get',
    params: { type: 'list', page, status, is_seckill: 1, order_no, start_time, end_time }
  })
}
// 获取物流列表
export function getDeliverList() {
  return request({
    url: 'back/logistics',
    method: 'get',
    params: { type: 'list' }
  })
}
// 发货
export function setSeckillDeliver({ id, logistics, logistics_number }) {
  return request({
    url: 'back/shop/order',
    method: 'post',
    data: { id, logistics, logistics_number },
    params: { type: 'deliver' }
  })
}
// 关闭订单
export function closeSeckillOrder({ order_no, remark }) {
  return request({
    url: 'back/shop/order',
    method: 'post',
    params: { type: 'close' },
    data: { order_no, remark }
  })
}
// 修改订单状态
export function amendSeckillStatus({ order_no, order_status }) {
  return request({
    url: 'back/shop/order',
    method: 'post',
    data: { type: 'updateOrderStatus', order_no, order_status }
  })
}
// 拼团
export function getClusterList(myType, page) {
  return request({
    url: 'back/spellActive/spellActive',
    method: 'get',
    params: { type: 'list', myType, page }
  })
}
// 添加
export function addClusterItem({ id, start_time, end_time, team_num, price, commodity_id }) {
  return request({
    url: 'back/spellActive/spellActive',
    method: 'post',
    data: { type: 'add', id, start_time, end_time, team_num, price, commodity_id }
  })
}
// 发布
export function clusterPublish({ id, is_publish }) {
  return request({
    url: 'back/spellActive/spellActive',
    method: 'post',
    data: { type: 'isPublish', id, is_publish }
  })
}
// 立即停止
export function stopCluster(id) {
  return request({
    url: 'back/spellActive/spellActive',
    method: 'post',
    data: { type: 'rightStop', id }
  })
}
// 获取活动详情
export function getClusterDetail(id) {
  return request({
    url: 'back/spellActive/spellActive',
    method: 'get',
    params: { type: 'getActiveInfo', id }
  })
}
// 删除拼团活动
export function deleteCluster(id) {
  return request({
    url: 'back/spellActive/spellActive',
    method: 'post',
    data: { type: 'delete', id }
  })
}
// 拼团订单
export function getClusterOrderList({ page, status, start_time, end_time, keyword }) {
  return request({
    url: 'back/spellActive/spellActive',
    method: 'get',
    params: { type: 'orderList', page, status, start_time, end_time, keyword }
  })
}
// 是否发布
export function setPublish({ id, is_publish }) {
  return request({
    url: 'back/seckill/commoditySecKill',
    method: 'post',
    params: { type: 'isPublish', id, is_publish }
  })
}
/* ******************************************************* */
export function getRepresentList(page, keyword) {
  return request({
    url: '/back/represent/represent',
    method: 'get',
    params: { type: 'list', page, keyword }
  })
}
export function checkFeedBack(id) {
  return request({
    url: '/back/represent/represent',
    method: 'get',
    params: { type: 'lookFeedback', id }
  })
}
export function getPendingApproveList({ page, status, keyword }) {
  return request({
    url: '/back/represent/represent',
    method: 'get',
    params: { type: 'checkImageList', page, status, keyword }
  })
}
export function passOrNopass({ my_type, id, remark }) {
  return request({
    url: '/back/represent/represent',
    method: 'post',
    params: { type: 'updateStatus', my_type, id, remark }
  })
}
// 退款审批
export function getRefundList({ page, status, keyword }) {
  return request({
    url: '/back/represent/represent',
    method: 'get',
    params: { type: 'refundApplyRecord', page, status, keyword }
  })
}
export function modificationRefound({ id, myType, message, remit_file }) {
  return request({
    url: '/back/represent/represent',
    method: 'post',
    data: { type: 'updateRefundApplyStatus', id, myType, message, remit_file }
  })
}
export function setRules(represent_commodity_rule) {
  return request({
    url: '/back/represent/represent',
    method: 'post',
    data: { represent_commodity_rule, type: 'set' }
  })
}
export function getRules() {
  return request({
    url: '/back/plat/setRule',
    method: 'post',
    data: { type: 'list' }
  })
}
// 代言订单管理
export function getRepresentOrderList({ page, order_status, order_no, start_time, end_time }) {
  return request({
    url: '/back/represent/represent',
    method: 'get',
    params: { type: 'orderList', page, order_status, order_no, start_time, end_time }
  })
}
// 订单详情
export function getOrderDetail(id) {
  return request({
    url: '/back/represent/represent',
    method: 'get',
    params: { type: 'lookOrderInfo', id }
  })
}
// 发货
export function setDeliver({ id, logistics_name, logistics_number }) {
  return request({
    url: '/back/represent/represent',
    method: 'post',
    params: { type: 'delivery', id, logistics_name, logistics_number }
  })
}
export function getDeliverType() {
  return request({
    url: '/back/logistics',
    method: 'get',
    params: { type: 'list' }
  })
}
export function closeOrder(id) {
  return request({
    url: '/back/represent/represent',
    method: 'post',
    params: { type: 'updateOrderStatus', id, myType: 5 }
  })
}
// 备注
export function setRemark({ id, message }) {
  return request({
    url: '/back/represent/represent',
    method: 'post',
    params: { type: 'updateOrderStatus', myType: 2, id, message }
  })
}
// 修改订单状态
export function amendOrderStatus({ id, myType }) {
  return request({
    url: '/back/represent/represent',
    method: 'post',
    params: { type: 'updateOrderStatus', id, myType }
  })
}
